package com.athuiju.hr.mapper;

import com.athuiju.hr.entity.Sector;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wzh
 * @since 2021-12-15
 */
@Repository
@Component
public interface SectorMapper extends BaseMapper<Sector> {

    /**
     * 查询部门列表*/
    @Select("SELECT * FROM `sector` where is_parent=0 and is_deleted=0")
    List<Sector> getThree();

    @Select("SELECT * FROM `sector` where parent_id=0 and is_deleted=0")
    List<Sector> getOneSec();


@Select("SELECT * FROM `sector` where is_deleted=0 and parent_id=#{parent_id}")
    List<Sector> getBranById(String sectorid);

    @Select("SELECT * FROM `sector` where is_deleted=0 and parent_id=#{parent_id}")
    List<Sector> getBranSonById(String sectorid);
}
